#'
#' calcualte the minimum distance to plot border
#'
#'
#'
#'

dist_to_border=function(data){
  plotdim=plotdim(data)
  return(apply(data.frame(data$x,plotdim[1]-data$x,data$y,plotdim[2]-data$y),1,min))
}